<?
session_start();
define('_VIEW_MODEL_','default');
require_once './init.php';
$friend = "";
$id = isset($_SESSION['id'])?$_SESSION['id']:intval($id);
$userinfo = $db->GetRow("select a.id,a.name,a.password,a.sex,a.headimage,a.phone,a.money,a.birthday,a.zodiac,a.const,a.tickets,a.likebook,a.onlinetime,a.lasttime,a.activetime,a.sign,a.created,a.isphone,a.state,b.title from {$telper}user as a left join {$telper}prop as b on a.medalid=b.id where a.id = '$id'");
$zomict = $zomictyle[$userinfo['zodiac']]==""?"保密":$zomictyle[$userinfo['zodiac']];
//print_R($userinfo);
$tim  = time();
$rs = $db->Execute("select `title`,`link` from {$telper}friendlink where state = 0 order by rank desc limit 0,6");
$friendinfo = $rs ->GetArray();
foreach($friendinfo as $k=>$v){
	$friend .="<a href='$v[link]'>$v[title]</a>";
	if($k+1 < count($friendinfo)){
		$friend .=".";
	}
}
//echo "select count(id) from {$telper}mail where `for` = $id";
$mail= $db->GetRow("select count(id) from {$telper}mail where `for` = $id");
$mailnum = !empty($mail['count(id)'])?$mail['count(id)']:'0';
$colmust = empty($colmustyle[$userinfo['const']])?"保密":$colmustyle[$userinfo['const']];
$age = ceil(($tim - $userinfo['birthday'])/(60*60*24*365));
$age = $userinfo['birthday']=="0"?"保密":$age;
header("Content-type:text/vnd.wap.wml;charset=utf-8");
$smartyObj->assign('userinfo',$userinfo);
$smartyObj->assign('zomicsty',$zomict);
$smartyObj->assign('mon',$userinfo['money']);
$smartyObj->assign("moneyname",$moneyname);
$smartyObj->assign("colmustyle",$colmust);
$smartyObj->assign("friend",$friend);
$smartyObj->assign("uid",$id);
$smartyObj->assign("time",$tim);
$smartyObj->assign("age",$age);
$smartyObj->assign("mailnum",$mailnum);
$smartyObj->display('bookhouse.tpl');
?>